forum

Home / DeveloperSection / Forums / How to Protractor - Counting the no.of elements and Display all the elements with For loop is Not getting executed

How to Protractor - Counting the no.of elements and Display all the elements with For loop is Not getting executed

Anonymous User 5196 03-Feb-2015

I am working on Protractor with Android hybrid app. I am trying to count the elements and Retrieve and display all the elements. I am able to get the count of the elements. But when I try to display, the For loop is not getting executed, nor gives any Error.

Kindly Advise. Here's my code below.

   var n1 = browser.element.all(by.className('program-details-directive-container')).count();
  browser.element.all(by.className('program-details-directive-container')).
  then( function(n1)
   {
    for(var i=0; i<n1;++i)
    {
      n1(i).getText().then(function(text1)
      {
       console.log(text1);
       })
     }
  });


Updated on 03-Feb-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By